import {
	API_PREFIX,
	API_PREFIX_CORE
} from '../config/env.js'
import http from '../utils/http.js'

const API = {
	GET_COMMON_BANNER: `${API_PREFIX_CORE}/api/v1/common/banner`,
	GET_COMMON_FIL_PRICE: `${API_PREFIX_CORE}/api/v1/common/fil/price`,
	GET_COMMON_FIL_OFFICIAL_DATA: `${API_PREFIX_CORE}/api/v1/common/fil/official/data`,
	GET_COMMON_NOTICE: `${API_PREFIX_CORE}/api/v1/common/notice`,
	GET_COMMON_NOTICEID: `${API_PREFIX_CORE}/api/v1/common/notice/{noticeId}`,
	GET_COMMON_HD_NEW: `${API_PREFIX_CORE}/api/v1/common/hd/new`,
	GET_EWALLET_MARKET: `${API_PREFIX_CORE}/api/v1/ewallet/market`,
	GET_BD_INFO: `${API_PREFIX}/api/v1/bd/ufil/info`,
	POST_BD: `${API_PREFIX}/api/v1/bd/ufil`,
	POST_BD_HCKJ_UFIL: `${API_PREFIX}/api/v1/bd/ufil/hckj`,
	GET_BD_INFO_IPFS: `${API_PREFIX}/api/v1/bd/ipfs/info`,
	POST_BD_HCKJ_IPFS: `${API_PREFIX}/api/v1/bd/ipfs/hckj`,
	
}


/**	
 * 获取轮播图
 */

export const getCommonBanner = function(data, config) {
	return http.get(API.GET_COMMON_BANNER, data, config)
}


/**	
 * FIL 价格与涨幅
 */

export const getCommonFilPrice = function(data, config) {
	return http.get(API.GET_COMMON_FIL_PRICE, data, config)
}

/**	
 * FIL 官方数据
 */

export const getCommonFilOfficialData = function(data, config) {
	return http.get(API.GET_COMMON_FIL_OFFICIAL_DATA, data, config)
}


/**	
 * 获取公告
 */

export const getCommonNotice = function(data, config) {
	return http.get(API.GET_COMMON_NOTICE, data, config)
}

/**	
 * 获取公告详情
 */

export const getCommonNoticeId = function(data, config) {
	const url = API.GET_COMMON_NOTICEID.replace(/{noticeId}/g, data.noticeId)
	return http.get(url, config)
}

/**	
 * 获取活动列表
 */

export const getCommonHdNew = function(data, config) {
	return http.get(API.GET_COMMON_HD_NEW, data, config)
}


/**	
 * 市场-涨幅榜
 */

export const getEwalletMarket = function(data, config) {
	return http.get(API.GET_EWALLET_MARKET, data, config, true)
}

/**	
 * 报单信息
 */

export const getBdInfo = function(data, config) {
	return http.get(API.GET_BD_INFO, data, config, true)
}

/**	
 * 我要报单
 */

export const postBD = function(data, config) {
	return http.post(API.POST_BD, data, config, true)
}

/**	
 * Ufil 合成矿机
 */

export const postBDHckjUfil = function(data, config) {
	return http.post(API.POST_BD_HCKJ_UFIL, data, config, true)
}

/**	
 * 报单信息
 */

export const getBdIpfsInfo = function(data, config) {
	return http.get(API.GET_BD_INFO_IPFS, data, config, true)
}

/**	
 * Ipfs 合成矿机
 */

export const postBDHckjIpfs = function(data, config) {
	return http.post(API.POST_BD_HCKJ_IPFS, data, config, true)
}
